next up previous
Next: 3.2 Multi-threading the Server Up: 3 Other Approaches Previous: 3 Other Approaches

3.1 Coroutines in Display PostScript

Adobe's Display PostScript (DPS) extension for X [1] uses a co-routine mechanism for the interpretation of PostScript. A client can create a DPSContext and send arbitrary PostScript commands to be interpreted. Unlike core X requests which execute immediately, DPS's PSGiveInput request only places PostScript commands in some DPSContext's buffer. Then the X server invokes the PostScript interpreter on the contents of each DPSContext with input to process.

  
Figure 1: Adobe's Display PostScript extension uses co-routines run from an X server wakeup handler whenever PostScript commands are ready to be executed. Frequent co-routine yielding maintains server interactivity.

Figure 1 shows how DPS's co-routine execution mechanism is integrated into the X server's dispatch loop using the BlockHandler and WakeupHandler facility. The co-routine mechanism has two advantages: no locking is necessary, and operating system process context switching is minimized. The mechanism has the disadvantage that true parallelism is impossible.

The DPS extension is supported by the Silicon Graphics X server using co-routines as described. Multi-rendering and DPS co-exist. Neither mechanism interferes with the other.



next up previous
Next: 3.2 Multi-threading the Server Up: 3 Other Approaches Previous: 3 Other Approaches



Mark Kilgard
Sun Jan 7 19:20:04 PST 1996